Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

395
Vistas
Docker: standard_init_linux.go:211: exec user process caused "no such file or directory"

I am trying to create a base image following the instructions given in official docker webpage(https://docs.docker.com/samples/library/scratch/)

    docker --version
    Docker version 18.09.6, build 481bc77

    OS Details:
    NAME="Ubuntu"
    VERSION="18.04.2 LTS (Bionic Beaver)"

DockerFile:

    FROM scratch
    COPY hello /
    CMD ["/hello"]

hello.c

    #include <stdio.h>
        int main()
        {
           // printf() displays the string inside quotation
           printf("Hello, World!");
           return 0;
        }

I am able to compile the C program and execute locally

I am able to build the image using the dockerfile but when I try to run the container, I get the below error:

    # docker run -i hello
        standard_init_linux.go:211: exec user process caused "no such file or directory" 
    #

I expect the container to run successfully and print "Hello World" on console. most of the answers provided are asking to change EOL which is not applicable as we are already on Linux and not trying to run script.

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

I guess you get this error because you built out a dynamic linked binary like next:

$ gcc -o hello hello.c
$ ldd hello
    linux-vdso.so.1 (0x00007ffe3b1ec000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7fe1fc7000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f7fe25ba000)

The scratch is really basic which do not have so many so for your binary to dynamic link. So, you need to build out a static link binary, like:

$ gcc -o hello -static hello.c
$ ldd hello
    not a dynamic executable

Then, it will be work like next:

$ docker build -t hello .
Sending build context to Docker daemon  848.4kB
Step 1/3 : FROM scratch
 --->
Step 2/3 : COPY hello /
 ---> 9d594b34f774
Step 3/3 : CMD ["/hello"]
 ---> Using cache
 ---> 2f1bad3099d3
Successfully built 2f1bad3099d3
Successfully tagged hello:latest
$ docker run -i hello
Hello, World!

And, if you do not use scratch image which have more .so in the system, then you no need to build out static binary.

over 4 years ago · Santiago Trujillo Denunciar

0

It seems this happens when the scripts have wrong line feeds. Based on git settings you might have DOS CRLF instead of UNIX LF. Setting the line feeds helped me fix the issue.

How to change line-ending settings

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda